﻿<UserControl x:Class="BloggerAutoPoster.Shell.Views.About"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
             xmlns:vm="clr-namespace:BloggerAutoPoster.Infrastructure.ViewModels;assembly=BloggerAutoPoster.Infrastructure"
             xmlns:b="clr-namespace:BloggerAutoPoster.Common.Behaviors;assembly=BloggerAutoPoster.Common"
             xmlns:extToolkit="clr-namespace:Microsoft.Windows.Controls"
             xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <vm:AboutViewModel x:Key="vmAboutViewModel" />
        <DataTemplate x:Key="myListItem" >
            <Border BorderBrush="Gray" Width="375" Height="auto" 
                    Background="#3d3d3d" 
                    BorderThickness="1" CornerRadius="6">
                <Grid Margin="7">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <Image VerticalAlignment="Top" 
                           Grid.Column="0"
                           Grid.Row="1"
                           Width="32" Height="32" Stretch="UniformToFill" 
                           Source="Images/box_download_48.png" Margin="2"/>

                    <TextBlock Foreground="Yellow" 
                               Grid.Row="0" Grid.Column="1"
                               TextAlignment="Left" FontWeight="Bold"
                               TextWrapping="Wrap" Text="{Binding Title}" Margin="2"/>

                    <TextBlock Foreground="Cyan"			
                               Grid.Row="1" Grid.Column="1"
							   HorizontalAlignment="Left"							   
							   b:WebHyperlink.LaunchDefaultBrowser="True" VerticalAlignment="Center">  
						        <Hyperlink Foreground="Cyan" NavigateUri="{Binding Link}">  
							        <TextBlock Width="Auto" TextWrapping="Wrap" Foreground="Cyan" Text="{Binding Link}"/>  
						        </Hyperlink>      
					    </TextBlock>

                    <TextBlock Text="{Binding Description}" 
                               Grid.Row="2" Grid.Column="1"
                               TextWrapping="Wrap" Margin="2"/>
                    <TextBlock Foreground="#F58244" 
                               Grid.Row="3" Grid.Column="1"
                               Text="{Binding PubDate}" TextWrapping="Wrap" Margin="2"/>
                    <TextBlock Text="{Binding Author}" Margin="2" Grid.Row="4" Grid.Column="1"/>
                </Grid>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <extToolkit:BusyIndicator IsBusy="{Binding IsBusy}"                                
                              DataContext="{Binding Source={StaticResource vmAboutViewModel}}"
                              BusyContent="Please wait..." 
                              DisplayAfter="00:00:00">
        <Grid>
            <GroupBox Header="ABout..." Margin="5">
                <ListView  
                    Margin="5" 
                    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                    ItemsSource="{Binding VersionsInfoData}">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel Orientation="Horizontal">
                                <i:Interaction.Behaviors>
                                    <ei:FluidMoveBehavior
                                        Tag="DataContext"
                                        AppliesTo="Children">
                                        <ei:FluidMoveBehavior.EaseY>
                                            <CubicEase
                                                EasingMode="EaseInOut" />
                                        </ei:FluidMoveBehavior.EaseY>
                                        <ei:FluidMoveBehavior.EaseX>
                                            <CubicEase
                                                EasingMode="EaseInOut" />
                                        </ei:FluidMoveBehavior.EaseX>
                                    </ei:FluidMoveBehavior>
                                </i:Interaction.Behaviors>
                            </WrapPanel>
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>

                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="History" CellTemplate="{StaticResource myListItem}" />
                        </GridView>
                    </ListView.View>
                </ListView>
            </GroupBox>
        </Grid>
    </extToolkit:BusyIndicator>
</UserControl>